<?php
session_start();
include "../public/common/config.php";

if($_POST){
	$username = $_POST['username'];
	$password = $_POST['password'];
	$repassword = $_POST['repassword'];
	
	if($password == $repassword){
		$password = md5($password);
		$sql = "insert into user(username,password) values('{$username}','{$password}')";
		if(mysql_query($sql)){
			$_SESSION['home_username'] = $username;
			$_SESSION['home_userid'] = mysql_insert_id();
			echo '<script>location="person/index.php"</script>';
		}
	}
}
?>